FROM centos:7

MAINTAINER ubisec

#  yum 更新
RUN set -ex \
	&& yum -y install zlib-devel bzip2-devel libffi-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make wget gcc-c++ perl \
	&& yum clean all \
    && mkdir /home/cvuln

# 复制所有文件到/home/cvuln/ 目录
COPY .  /home/cvuln

#安装Python3
RUN set -ex \
	&& cd /home/cvuln \
	&& tar -zxvf openssl-1.1.1.tar.gz \
	&& cd openssl-1.1.1 \
	&& ./config shared --openssldir=/usr/local/openssl --prefix=/usr/local/openssl \
	&& make && make install \
	&& echo "/usr/local/lib64/" >> /etc/ld.so.conf \
	&& echo "/usr/local/openssl/lib" >> /etc/ld.so.conf \
	&& ldconfig \
	&& ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl \
	&& ln -s /usr/local/openssl/include/openssl /usr/include/openssl \
	&& cd .. \
	&& tar -xvJf  Python-3.10.6.tar.xz \
	&& cd Python-3.10.6 \
	&& ./configure --prefix=/usr/local/python3 --with-openssl=/usr/local/openssl \
	&& make && make install \
    && cd .. \
	&& yum install -y epel-release \
    && yum install -y python-pip \
	&& ln -s /usr/local/python3/bin/python3 /usr/bin/python3 \
	&& ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

# 安装python更新pip
RUN set -ex \
	&& python3 -V \
	&& python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip\
    && python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple  semgrep

# 安装yum 工具
RUN set -ex \
 	&& yum  install -y lrzsz \
	&& yum  install -y net-tools \
 	&& yum  install -y zip unzip \

#中文编码
RUN yum -y install kde-l10n-Chinese
RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
ENV LC_ALL zh_CN.UTF-8
ENV LANG zh_CN.UTF-8

#jdk 1.8
ADD jdk-8u221-linux-x64.tar.gz /usr/local
ENV JAVA_HOME /usr/local/jdk1.8.0_221
ENV CLASSPATH .;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar;%MAVEN_HOME%\lib
ENV PATH $PATH:$JAVA_HOME/bin

# 启动配置
RUN set -ex \
	&& cd /home \
 	&& pip list \
	&& echo "build success."
